package com.tarena.luban.demo.rocket.controller;

import org.apache.rocketmq.spring.core.RocketMQTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.messaging.Message;
import org.springframework.messaging.support.MessageBuilder;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class SendController {
    @Autowired
    private RocketMQTemplate rocketMQTemplate;
    @GetMapping("/test/send")
    public String testSend(String message){
        Message msg= MessageBuilder.withPayload(message).build();
        rocketMQTemplate.syncSend("rocket-topic-test",message);
        return "OK";
    }
}
